<?php
/**
 * Created by PhpStorm.
 * User: alinejun
 * Date: 2019/1/6
 * Time: 19:31
 */
namespace app\admin\controller;
use app\common\controller\ControllerBase;
use think\Db;

class User extends AdminBase{
    /**
     * 用户列表
     */
    protected $user;
    public function _initialize()
    {
        $this->user = new \app\common\model\User();
        parent::_initialize();
    }
    public function index()
    {
        $user =  new \app\common\model\User();
        $seacch_data = input('param.search_data');
        $where = [];
        !empty($seacch_data) and   $where =['nickname|username|phone'=>['like','%'.$seacch_data.'%']];
        $list = $user->search($where);
        $this->assign('list', $list);
        return $this->fetch('index');
    }

    public function del()
    {
        $where['id'] = input('id');
        $res = $this->user->del($where,'status',-1);
        if($res){
            return $this->success('删除成功');
        }else{
            return $this->error('删除失败');
        }
    }
}